<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        [v=clock]{
            display: none;
        }
    </style>
</head>
<body>
<div id="vue" v-cloak>
    <!--<div>{{info.name}}</div>
    <div>{{info.address.city}}</div>
    <a v-bind:href="info.url">点我</a>-->
    <div>{{name}}</div>
</div>

<script src="https://cdn.jsdelivr.net/npm/vue@2.5.21/dist/vue.min.js"></script>
<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.19.2/axios.min.js"></script>
<script type="text/javascript">
    var vm = new Vue({
        el: "#vue",
        data:{
            name: ''
        },
        mounted() {
            // 钩子函数
            axios.get('./data.json').then(res => {
                this.name = res.data.name
            });
        },
        // data()是函数 带有return data: 是属性
        /*data(){
            return{
                info:{
                    name: '',
                    url: '',
                    address: {
                        street: null,
                        city: null,
                        county: null
                    }
                }
            }
        },
        mounted() {
          // 钩子函数
            axios.get('./data.json').then(res => {
                this.info = res.data
            });
        },*/
    });
</script>
</body>
</html>
